<?php
/**
 * Get all modules and controllers which have an app.ini file
 *
 * @author     Mario Schillermann <info@rockit-flash.com>
 * @encoding   UTF-8 äöüßÖÄÜ
 * @copyright  © 2011 Mario Schillermann (info@rockit-flash.com)
 * @license    GNU GPL v2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @uses       App_Model_Module_Interface
 * @category   Library
 * @package    App
 * @subpackage Model
 * @todo
 */
class App_Model_Module extends App_Model_Module_Abstract
{
    
    /**
     * Read directory from all modules
     * 
     * @return array 
     */
    public function getModulesAndControllers()
    {
        $modulesAndControllers = array();

        foreach ($this->getModules() as $module => $dir) {
            
            foreach (glob($dir . "/*Controller.php") as $filePath) {
                
                $filename = basename($filePath);
                $controller = strtolower(str_replace("Controller.php", null, $filename));
                $modulesAndControllers[$module][] = $controller;
            }
        }

        return $modulesAndControllers;
    }
}